package SeleniumTest;

import junit.framework.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
//import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.Test;
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.testng.annotations.DataProvider;

import static org.openqa.selenium.By.className;
import static org.openqa.selenium.By.cssSelector;
import static org.openqa.selenium.By.linkText;

import org.openqa.selenium.remote.RemoteWebDriver;

/**
 * Created with IntelliJ IDEA.
 * User: ae
 * Date: 09.07.13
 * Time: 22:08
 * To change this template use File | Settings | File Templates.
 */
public class BuxferLoginLogout {

    @Test
    public void LoginLogoutTest() {
        WebDriver driver = new FirefoxDriver();
        driver.get("https://www.buxfer.com/");
        driver.manage().window().maximize();
        driver.findElement(By.linkText("Login")).click();
        driver.findElement(cssSelector("input[id='login_username']")).sendKeys("testuser@gmail.com");
        driver.findElement(cssSelector("input[id='login_password']")).sendKeys("Pa$$word");
        driver.findElement(By.linkText("Login")).click();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.findElement(By.cssSelector("div.drpdwnHandler")).click();
        driver.findElement(By.id("header-account-12")).click();
        driver.findElement(cssSelector("input[id='login_username']")).sendKeys("testuser@gmail.com");
        driver.findElement(cssSelector("input[id='login_password']")).sendKeys("Pa$$word");
        driver.findElement(By.linkText("Login")).click();
        Assert.assertFalse(driver.findElement(cssSelector("div[class='overlayTitle']")).isDisplayed());
        driver.close();
    }
}
